package csu.jpetstore.jpetstore.service;

import com.sun.istack.NotNull;
import csu.jpetstore.jpetstore.domain.Category;
import csu.jpetstore.jpetstore.repository.CategoryRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CategoryService {
    @Autowired
    CategoryRepository categoryRepository;
    public Category getCategory(@NotNull int id){
        return categoryRepository.findAllById(id);
    }
    public Category getCategory(@NotNull String name){
        return categoryRepository.findAllByName(name);
    }
}
